﻿using IH.Comm.Dtos.MiniApp;
using IH.Comm.Dtos.Users;
using IH.Service;
using IH.Storage.Entity;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using MongoDB.Bson;
using MongoDB.Driver;
using NAutowired.Core.Attributes;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace IH.Apis.Controllers
{
    [ApiController]
    public class MiniAppController : CoreController
    {
        [Autowired]
        private MiniAppRegService _miniAppRegService { get; set; }

        /// <summary>
        /// 根据token获取用户信息
        /// </summary>
        /// <param name="input"><see cref="MiniAppRegSaveInput"/></param>
        /// <returns><see cref="UserInfoOutput"/></returns>
        /// <created>tanch,2021/4/5</created>
        /// <changed>tanch,2021/4/5</changed>
        [HttpPost("reg/save")]
        public void GetUserByToken([FromBody]MiniAppRegSaveInput input)
            => _miniAppRegService.SaveMiniAppReg(input,base.CurrentUser);
    }
}
